package com.bang.concurrency.example.publish;

import com.alibaba.fastjson.JSONObject;
import com.bang.concurrency.annotations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

/**
 * @Auther: Bang
 * @Date: 2019/9/30 20:59
 * @Description: 不安全发布对象
 */
@Slf4j
@NotThreadSafe
public class UnsafePublish {

    private String[] values = new String[]{"a", "b", "c"};

    public String[] getValues() {
        return values;
    }

    public static void main(String[] args) {
        UnsafePublish unsafePublish = new UnsafePublish();
        String[] values = unsafePublish.getValues();
        log.error("values:{}", JSONObject.toJSONString(values));
        values[0] = "b";
        log.error("values:{}", JSONObject.toJSONString(values));
    }
}
